package com.jingwu.example.service

import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ActiveProfiles
import spock.lang.Ignore
import spock.lang.Specification

import javax.annotation.Resource

/**
 * 使用 @SpringBootTest 运行 spock 测试用例
 *
 * @author 菁芜
 * @since 2021/11/20
 */
@Ignore
@ActiveProfiles("test")
@SpringBootTest
class BarServiceTest extends Specification {

    @Resource
    FooService service;

    def "add"() {
        given:
        def i = 1
        when:
        i++
        then: "aa"
        i == 2
    }

    def "test add"() {
        expect: "加法测试"
        service.add(a, b) == result

        where: "边界"
        a  | b  | result
        1  | 2  | 3
        2  | 2  | 4
        10 | 10 | 20

    }
}
